package com.jiawei.entity.pojo;

import lombok.Builder;
import lombok.Data;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

/**
 * @author : willian fu
 * @date : 2019/12/11
 */
@Data
@Builder
public class Rt {

    /**
     * 200 ok
     * @param body
     * @return
     */
    public static Object ok(Object body){
        return ResponseEntity.ok(body);
    }

    /**
     * 参数错误
     * @param msg
     * @return
     */
    public static Object badRequest(Object msg){
        return ResponseEntity.badRequest().body(msg);
    }

    /**
     * 无返回信息
     * @param msg
     * @return
     */
    public static Object noContent(Object msg){
        return ResponseEntity.status(HttpStatus.NO_CONTENT).body(msg);
    }

    /**
     * 没有找到
     * @param msg
     * @return
     */
    public static Object notFound(Object msg){
        return ResponseEntity.status(HttpStatus.NOT_FOUND).body(msg);
    }

    /**
     * 未授权
     * @param msg
     * @return
     */
    public static Object noAuthority(Object msg){
        return ResponseEntity.status(HttpStatus.FORBIDDEN).body(msg);
    }

    /**
     * 禁止访问
     * @param msg
     * @return
     */
    public static Object forbidden(Object msg){
        return ResponseEntity.status(HttpStatus.FORBIDDEN).body(msg);
    }
}
